home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
wb
/
czesc_4
/
wbgenie
/
source
/
eg.c
next >
Wrap
C/C++ Source or Header
|
1993-03-13
|
3KB
|
92 lines
/*
** WBGenie is Copyright 1992 by Steven Velletri. All Rights Reserved
**
** Filename: eg.c
** Release: 1.0
** Revision: 0.0
** Date: 26/07/92
** Author: Steven Velletri
** Purpose:
** To demostrate how to use the routines in sup_lib.c
** It updates the tool types:
** WBG_TOP_EDGE
** WBG_LEFT_EDGE
** WBG_WIDTH
** WBG_HEIGHT
** with out affecting any others which may exist.
**
** History:
**
** Version Author Date Reason
** 0.00 SV 10/11/92 Created
**
** To compile this module I used the SAS/C compiler version 5.10a.
*/
/* Include other appropriate header files here */
#include "sup_lib.h"
/* Need to create this */
struct SUPTOOLTYPES wbg_position_tool_types[] =
{
{ "WBG_TOP_EDGE", 0 },
{ "WBG_LEFT_EDGE", 0 },
{ "WBG_WIDTH", 0 },
{ "WBG_HEIGHT", 0 },
};
BOOL wbg_save_position_tool_types(UBYTE top_edge,
UBYTE left_edge,
UBYTE width,
UBYTE height,
char * icon_name)
{
struct DiskObject *dobj;
char ** oldtooltypes, **wbg_tt_buf, **tt_buf;
/* This allocates a 4bytex128byte two dimensional array. */
wbg_tt_buf = tt_buf = sup_get_buf(4, 128);
if (wbg_tt_buf == NULL)
return(FALSE);
if (dobj = GetDiskObject(icon_name))
{
/* Store the pointer to the original tool types */
oldtooltypes = dobj->do_ToolTypes;
/* This writes into the two dimensional array created above */
sprintf(*(tt_buf++), "%s=%d", "WBG_TOP_EDGE", top_edge);
sprintf(*(tt_buf++), "%s=%d", "WBG_LEFT_EDGE", left_edge);
sprintf(*(tt_buf++), "%s=%d", "WBG_WIDTH", width);
sprintf(*(tt_buf++), "%s=%d", "WBG_HEIGHT", height);
/* This does all the hard work */
dobj->do_ToolTypes =
sup_create_tool_type_array(dobj->do_ToolTypes,
wbg_tt_buf,
wbg_position_tool_types,
4);
if (dobj->do_ToolTypes)
{
PutDiskObject(icon_name, dobj);
/* This free must be done */
sup_free_tool_type_array(dobj->do_ToolTypes);
}
/* Restore the pointer to the original tool types */
dobj->do_ToolTypes = oldtooltypes;
FreeDiskObject(dobj);
}
/* This free must also be done */
free(*wbg_tt_buf);
return(TRUE);
}